package the.broccoli.uc.service;

import org.wisteria.framework.web.mvc.service.ISuperService;
import the.broccoli.ac.constant.ResType;
import the.broccoli.ac.dto.ResDTO;
import the.broccoli.ac.dto.ResTree;
import the.broccoli.ac.entity.Res;
import the.broccoli.uc.entity.RoleRes;

import java.util.List;

/**
 * <p>
 * 角色与资源 服务类
 * </p>
 *
 * @author lei.liu
 * @since 2018-10-29
 */
public interface IRoleResService extends ISuperService<RoleRes> {

    /**
     * 获取已关联的资源ID
     * @param roleId
     * @return
     */
    List<String> getResIdList(String roleId);

    /**
     * 根据角色ID获取关联的资源；树形结构
     * @param roleId
     * @return
     */
    List<ResDTO> getResList(String roleId);

    /**
     *根据角色ID获取关联的资源；树形结构
     * @param roleIdList
     * @return
     */
    List<ResDTO> getResList(List<String> roleIdList);

    List<ResTree> getResTree(String roleId);
    List<ResTree> getResTree(List<String> roleIdList, List<ResType> resTypeList);

    List<Res> getResList(ResType resType);
    List<Res> getResList(List<String> roleIdList, ResType resType);

    void save(String roleId, List<String> resIdList, String createdId, String createdName);

    /**
     * 删除租户的应用资源
     * @param roleId    角色ID
     * @param appId     应用ID
     * @return  执行结果
     */
    boolean removeAppResOfRole(String roleId, Integer appId);
}
